<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script>
            var a=10;
            function aa(){
                console.log("我是aa函数");
            }
            console.log(window.a);
            window.aa();
            function doOpen(){
                // 打开指定窗口
                // window.open("success.html");

                // window.open(url,name,特征)
                // window.open("success.html","mywindow","width=400px,height=500px");

                window.open("53.location.html","mywindow2","width=400px,height=500px");
            }
            function doClose(){
                // window.close();
                close();
            }


            var timer;

            function show(){
                console.log("哈哈哈");
            }

            // window.setTimeOut(函数,毫秒值)
            function doTimeOut(){
                setTimeout(show,1000);

                // timer=setTimeout(function(){
                //     console.log("我是一次性计时器")
                // },1000);//1s后执行函数
                // console.log(timer);
            }
            function doClear(){
                clearTimeout(timer);//清除一次性计时器
            }
            // window.setInterval(函数,毫秒值)
            var timer2;
            function doInterval(){
                timer2=window.setInterval(function(){
                    console.log("我是周期性计时器");
                },1000);//每隔1s执行一次，周期性计时器
            }
            function doClear2(){
                window.clearInterval(timer2);
            }
        </script>
    </head>
    <body>
        <input type="button" value="open" onclick="doOpen()">
        <input type="button" value="close"onclick="doClose()">
        <input type="button" value="一次性计时器" onclick="doTimeOut()">
        <input type="button" value="取消(清除)计时器" onclick="doClear()">
        <input type="button" value="周期性计时器" onclick="doInterval()">
        <input type="button" value="取消(清除)计时器" onclick="doClear2()">
    </body>
</html>